package com.radiation.rms.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 实时数据表
 * </p>
 *
 * @author 1062
 * @since 2021-04-02
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "RealTimeData对象", description = "实时数据表")
public class RealTimeData implements Serializable, Comparable<RealTimeData> {

    private static final long serialVersionUID = 1296692438549891752L;

    @ApiModelProperty(value = "自增序号")
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;

    @ApiModelProperty(value = "实时数值")
    private Double record;

    @ApiModelProperty(value = "设备号")
    private String mac;

    @ApiModelProperty(value = "0：显示，1：删除")
    private String status;

    @ApiModelProperty(value = "逻辑删除 1（true）已删除， 0（false）未删除")
    @TableField(fill = FieldFill.INSERT)
    @TableLogic
    private Boolean isDeleted;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date gmtCreate;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date gmtModified;

    @ApiModelProperty(value = "部门名称")
    @TableField(exist = false)
    private String departmentName;

    @ApiModelProperty(value = "部门Id")
    @TableField(exist = false)
    private String departmentId;

    @ApiModelProperty(value = "部门名称")
    @TableField(exist = false)
    private String fullName;

    @Override
    public int compareTo(RealTimeData o) {
        return new Integer(this.getMac()) - new Integer(o.getMac());
    }
}
